/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fait.ferm.ui;

import fait.ferm.datafx.TableViewFactory;
import fait.ferm.global.Glob;
import fait.ferm.global.TB;
import fait.ferm.persists.Directory;
import fait.ferm.ui.tables.SupPurRow;
import fait.ferm.ui.tables.TaxesPayRow;
import java.net.URL;
import java.util.Date;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableView;
import javafx.scene.layout.StackPane;

/**
 *
 * @author alex
 */
public class PlanTabPurchasePaneController implements Initializable {
	@FXML 
	private StackPane supSP;
	@FXML 
	private StackPane cowSP;
	@FXML 
	private StackPane equipSP;

	@FXML
	TableView<TB.Table4Col> cowTab; 
	@FXML
	TableView<TB.Table4Col> equipTab; 
	
	private TableView<SupPurRow> supTable;
	//private TableView<CowPurRow> cowTable;
	//private TableView<EquipPurRow> equipTable;

	@Override
	public void initialize(URL url, ResourceBundle rb) {
		fillSupPurTable();
		fillCowPurTable();
		fillEquipPurTable();
	}
	
	public void fillSupPurTable(){
		Directory d = Glob.getDirInCache("supplies");
		ObservableList<SupPurRow> persItems = FXCollections.observableArrayList();
		// TODO заполнить настоящими данными
		persItems.add(new SupPurRow(d.get(1), 1000.0, 5200.0, new Date(),false));
		persItems.add(new SupPurRow(d.get(4), 200, 6900.0, new Date(),false));
		persItems.add(new SupPurRow(d.get(5), 50.0, 3000.0, new Date(),false));

		supTable = TableViewFactory.create(SupPurRow.class, persItems).buildTableView();
		supSP.getChildren().add(supTable);
		
	}
	
	public void fillCowPurTable(){
		ObservableList<TB.Table4Col> items = FXCollections.observableArrayList();
		items.add(new TB.Table4Col("Голштинская", "2012-10-22", "10", "1800000"));
		items.add(new TB.Table4Col("Айршир", "2012-10-25", "20", "2400000"));
		TB.bind(cowTab);
		cowTab.setItems(items);

	}
	public void fillEquipPurTable(){
		ObservableList<TB.Table4Col> items = FXCollections.observableArrayList();
		items.add(new TB.Table4Col("Доильный зал", "2012-10-24", "1", "20000000"));
		TB.bind(equipTab);
		equipTab.setItems(items);

	}
	
}
